package com.heima.wemedia.feign;

import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.wemedia.dtos.ChannelDto;
import com.heima.model.wemedia.pojos.WmChannel;
import com.heima.wemedia.service.WmChannelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class AdminChannelController implements IWemediaClient {

    @Autowired
    private WmChannelService wmChannelService;

    /**
     * 修改频道
     *
     * @param wmChannel
     * @return
     */
    @PostMapping("/api/v1/channel/update")
    public ResponseResult updateChannels(@RequestBody WmChannel wmChannel) {
        return wmChannelService.updateChannels(wmChannel);
    }

    /**
     * 保存频道
     *
     * @param wmChannel
     * @return
     */
    @PostMapping("/api/v1/channel/save")
    public ResponseResult saveChannels(@RequestBody WmChannel wmChannel) {
        return wmChannelService.saveChannels(wmChannel);
    }

    /**
     * 频道名称模糊分页查询
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/channel/list")
    public ResponseResult checkListChannels(@RequestBody ChannelDto dto) {
        return wmChannelService.checkListChannels(dto);
    }

    /**
     * 平台管理-删除频道
     *
     * @param id
     * @return
     */
    @GetMapping("/api/v1/channel/del/{id}")
    public ResponseResult delChannels(@PathVariable("id") Integer id) {
        return wmChannelService.delChannels(id);

    }


}
